<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改章节')" />
</head>
<body class="white-bg">
<form class="form-horizontal m" id="form-content-update" th:object="${content}">

    <div class="form-group">
        <label class="col-sm-3 control-label is-required">book_id：</label>
        <div class="col-sm-8">
            <input class="form-control" type="text" name="book_id" readonly id="book_id" th:field="*{book_id}"  required>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label is-required">chapter_id：</label>
        <div class="col-sm-8">
            <input class="form-control" type="text" name="chapter_id" readonly id="chapter_id" th:field="*{chapter_id}"  required>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label is-required">content：</label>
        <div class="col-sm-8">
            <textarea class="form-control" type="text" name="content"  id="content" th:field="*{content}"  required>

            </textarea>
        </div>
    </div>

</form>

<th:block th:include="include :: footer" />
<script type="text/javascript">
		var prefix = ctx + "book/chapter";

		$("#form-content-update").validate({
			rules:{
				dictSort:{
					digits:true
				},
			},
			focusCleanup: true
		});

		function submitHandler() {
		console.log("submit content..");
	        if ($.validate.form()) {
	        	$.operate.save(prefix + "/updateContent", $('#form-content-update').serialize(),function(data){
	        	console.log("update success");
	        	console.log(data);
	        	$.operate.successCallback(data);
	        	});
	        }
	        else
	        {
	            console.log("validate fail");
	        }
	    }

	</script>

</body>
</html>